home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 27 / Mac Magazin and MacEasy Magazine CD - Issue 27.iso / Grafik & Text / Sans-Faute⁄Grammaire ƒ / Adaptateurs / Sources des scripts (anglais) / Vérification FrameMaker® next >
Text File  |  1996-02-20  |  1KB  |  43 lines

  1. set kMaxCheckingSFG to 32000 -- max number of characters that Sans-Faute/Grammaire can check
  2.  
  3. tell application "FrameMaker5"
  4.     set FrontDocPresent to exists front document
  5. end tell
  6.  
  7. if FrontDocPresent then
  8.     
  9.     tell application "FrameMaker5"
  10.         set nbStory to count text flows of front document
  11.     end tell
  12.     
  13.     -- loop on each story
  14.     repeat with storyIdx from 1 to nbStory
  15.         
  16.         tell application "FrameMaker5"
  17.             set storySize to count character of text flow storyIdx of front document
  18.         end tell
  19.         
  20.         if storySize > 0 then -- do something only for non null stories
  21.             tell application "FrameMaker5"
  22.                 set nbParagraph to count paragraph of text flow storyIdx of front document
  23.             end tell
  24.             repeat with paragraphIdx from 1 to nbParagraph
  25.                 tell application "FrameMaker5"
  26.                     set paragraphSize to count character of paragraph paragraphIdx of text flow storyIdx of front document
  27.                 end tell
  28.                 if paragraphSize > kMaxCheckingSFG then
  29.                     display dialog "Le paragraphe " & paragraphIdx & " du bloc " & storyIdx & " dépasse 32000 caractères. Sans-Faute/Grammaire ne peut pas le vérifier !"
  30.                 else
  31.                     set objToCheck to {a reference to paragraph paragraphIdx of text flow storyIdx of front document}
  32.                     tell application "Sans-Faute/Grammaire 2"
  33.                         Checking objToCheck ClientAddress Application "FrameMaker5"
  34.                     end tell
  35.                 end if
  36.             end repeat
  37.         end if
  38.         
  39.     end repeat
  40. else
  41.     display dialog "Aucun document n'est ouvert dans FrameMaker"
  42. end if
  43.